home *** CD-ROM | disk | FTP | other *** search
/ How Would You Survive? / How Would You Survive (1995)(Grolier)[Mac-PC].iso / mac / SHARED.DIR / 01990_Script_GameControlClass < prev    next >
Text File  |  1995-09-13  |  11KB  |  354 lines

  1. property iLevelRects, iLevToJump, iExitList, iMainMovieList, iFrameBeforeHelp, iButtonWorld
  2. global oGame, oLastGame
  3. global gGameBtn1, gGameBtn2, gGameBtn3,gGameBtn4, gGameBtn5, gGameBtn6, gGameBtn7, gGameBtn8
  4. global gBtn16, gBtn17, gBtn18
  5. global gAnsA, gAnsB, gAnsC, gWhatMovie
  6.  
  7. on birth me
  8.   set iLevelRects=[rect(220, 173, 420, 207),rect(220, 205, 420, 236),rect(220, 230, 420, 261),rect(220, 261, 420, 291),rect(220, 293, 420, 324)]
  9.   
  10.   set vAztecList=value(the text of field "AztecLinks")
  11.   sort vAztecList
  12.   set vEgyptList= value(the text of field "EgyptLinks")
  13.   Sort vEgyptList
  14.   set vVikingList= value(the text of field "VikingLinks")
  15.   Sort vVikingList
  16.   set vMasterList= value(the text of field "MasterLinks")
  17.   sort vMasterList
  18.   
  19.   set iMainMovieList=["A":"AztecW", "E":"EgyptW","V":"VikingW"]
  20.   set iExitList=["A":vAztecList, "E":vEgyptList,"V":vVikingList,"M":vMasterList]
  21.   sort iExitList
  22.   set iButtonWorld="None"
  23.   set iLevToJump=0
  24.   return me
  25. end birth
  26.  
  27. on mLeaveToToc me, pChipName
  28.   -- CALLED WHEN USER CLICKS ON A TABLE OF CONTENTS CHIP TO TAKE USER TO CONTENT
  29.   set vLevel=mgetlevel(ogame)
  30.   if vLevel<4 then
  31.     set vListName=char 1 of the moviename
  32.   else
  33.     set vListName="M"
  34.   end if
  35.   set vActiveLocList=getaprop(iExitList, vListName)
  36.   delete char 1 to 4 of pChipName
  37.   set vJumpCommand=getaprop(vActiveLocList, pChipName)
  38.   if vLevel<4 then
  39.     set gWhatMovie=getaprop(iMainMovielist, vListName)
  40.   else
  41.     set gWhatMovie=getaprop(iMainMovielist, (char 1 of pChipName))
  42.   end if
  43.   if not(((vJumpcommand contains "Time") and (vJumpCommand<>"MeasuringTime")) or (vJumpcommand contains "BasicFacts") or(vJumpcommand contains "Map")) then --APN 7/19
  44.     put "Cross" after vJumpCommand
  45.   else
  46.     
  47.     -- KLUGE FOR TIMELINE QUESTION
  48.     -- (Level 4, question 50 -- goes to timeline of world you are in)
  49.     -- ALL OTHER MASTER QUESTIONS ARE IDENTICAL IN ALL THREE WORLDS
  50.     if (vJumpCommand contains "Time") and (mgetlevel(oGame)=4) then
  51.       put char 1 of the moviename into char 1 of vJumpCommand
  52.     end if
  53.     
  54.   end if
  55.   put "Here's gWhatMovie:"&gWhatMovie
  56.   put "Here's vJumpCommand:"&vJumpCommand
  57.   do vJumpCommand
  58. end mLeaveToToc
  59.  
  60. on mEndMovieExit me
  61.   set oGame=0
  62.   set oLastGame=0
  63.   set vListName=char 1 of the moviename
  64.   set gWhatMovie=getaprop(iMainMovielist, vListName)
  65.   TableCross
  66. end mEndMovieExit
  67.  
  68. on mRollLevels me
  69.   set vClicked=false
  70.   set vPoint=point(the mouseh, the mousev)
  71.   if the stilldown then 
  72.     set iLevToJump=(the frame-marker(0))-1
  73.   else 
  74.     -- ELSE THE MOUSE IS UP
  75.     
  76.     -- IF A LEVEL HAS BEEN CHOSEN
  77.     if iLevToJump>0 then
  78.       set vClicked=true
  79.       -- process response
  80.       
  81.       -- IF THE CHOICE WAS ANYTHING OTHER THAN CANCEL
  82.       if iLevToJump<5 then
  83.         if objectp(oGame) then
  84.           mFlushChips(oGame) --APN 7/19
  85.           set oGame=0
  86.         end if
  87.         if objectp(oLastGame) then --APN 7/19
  88.           mFlushChips(oLastGame)
  89.           set oLastGame=0
  90.         end if
  91.         mStartGame(me, iLevtoJump)
  92.         set iLevToJump=0
  93.         
  94.       else 
  95.         -- USER HAS CHOSEN CANCEL
  96.         
  97.         -- IF A GAME IN PROGRESS
  98.         if objectp(oLastGame) then
  99.           set oGame=oLastGame
  100.           set oLastGame=0
  101.           
  102.           -- IF THE GAME IN PROGRESS IS IN ANOTHER WORLD
  103.           if char 1 of the moviename<>mGetWorld(oGame) then
  104.             --put "other"
  105.             turnoffpuppets 1 --APN 7/19
  106.             put "Going to movie:"&mGetWorld(oGame)
  107.             go movie (mGetWorld(oGame)&"Game.DIR")
  108.             makegamebuttons me, (char 1 of the moviename)
  109.           else 
  110.             -- ELSE THE GAME IN PROGRESS IS IN THE CURRENT WORLD
  111.             --put "current"
  112.             makegamebuttons me, (char 1 of the moviename)
  113.             go label("Chips")
  114.             mresumegame(oGame)
  115.           end if
  116.           
  117.         else 
  118.           -- NO GAME IS IN PROGRESS RETURN TO CONTENT
  119.           -- cancel is being called w/out an existing last game
  120.           leavegame
  121.         end if
  122.       end if
  123.       -- if a choice has been made clear out this object's LEVEL setting
  124.       set iLevToJump=0   
  125.     end if
  126.   end if
  127.   
  128.   -- IF NO CHOICE HAS BEEN MADE, THEN KEEP CYCLING FRAMES
  129.   set vWheretojump=mFindRectInList(me, vPoint, iLevelRects)
  130.   if vWhereToJump then
  131.     HandCursor
  132.   else
  133.     ArrowCursor
  134.   end if
  135.   if not(vClicked) then go frame(marker(0)+vWhereToJump+1)
  136. end mRollLevels
  137.  
  138.  
  139. on mFindRectInList me, pPoint, pRectList
  140.   set vFound=false
  141.   set vIndex=0
  142.   set vListLen=count(pRectList)
  143.   repeat while vFound=0 and vIndex<vListLen
  144.     set vIndex=vIndex+1
  145.     set vFound=inside(pPoint, getat(pRectList, vIndex))
  146.   end repeat
  147.   return vFound*vIndex
  148. end mFindRectList
  149.  
  150. on mQuestionRoll me
  151.   if not(rollover(43)) then
  152.     if hilight(gAnsA) then exit
  153.     if hilight(gAnsB) then exit
  154.     if hilight(gAnsC) then exit
  155.   end if
  156.   arrowcursor
  157.   --if hilight(gGameBtn4) then exit
  158. end mQuestionRoll
  159.  
  160. on mRestartRoll me
  161.   if hilight(gGameBtn5) then exit
  162.   if hilight(gGameBtn6) then exit
  163.   arrowcursor
  164. end mRestartRoll
  165.  
  166. on mChipRoll me
  167.   -- must call into oGame to get chips
  168.   if ((the mouseh<85) and (the mousev>290))  or (the mousev<70) then
  169.     if hilight(gGameBtn1) then exit
  170.     if hilight(gGameBtn2) then exit
  171.     if hilight(gGameBtn3) then exit
  172.     if objectp(gBtn16) then
  173.       if hilight(gBtn16) then exit
  174.     end if
  175.     if objectp(gBtn17) then
  176.       if hilight(gBtn17) then exit
  177.     end if
  178.     if objectp(gBtn18) then
  179.       if hilight(gBtn18) then exit
  180.     end if
  181.   else
  182.     set vButList=mgetChipList(oGame)
  183.     set vLIstLen=count(vButList)
  184.     set vChipNum=0
  185.     set vFound=False
  186.     repeat while ((vFound=false) and (vChipNum<vListLen))
  187.       set vChipNum=vChipNum+1
  188.       if hilight(getat(vButList, vChipNum)) then
  189.         set vFound=true
  190.         exit
  191.       end if
  192.     end repeat
  193.   end if
  194.   arrowcursor
  195. end mChipRoll
  196.  
  197. on mGIPRoll me
  198.   if hilight(gGameBtn7) then exit
  199.   if hilight(gGameBtn8) then exit
  200. end mGIPRoll
  201.  
  202. on mKillGIP me
  203.   watchcursor
  204.   hidecontrol(gGameBtn7)
  205.   hidecontrol(gGameBtn8)
  206.   makegamebuttons me, (char 1 of the moviename)
  207.   set oGame=0
  208.   go frame "Level"
  209. end mKillGIP
  210.  
  211. on mExitToGIP me
  212.   hidecontrol(gGameBtn7)
  213.   hidecontrol(gGameBtn8)
  214.   set vMovieExitScript=mGetWorld(oGame)&"GAME"
  215.   do vMovieExitScript
  216. end mExitToGIP
  217.  
  218.  
  219.  
  220. on mEnterGame me
  221.   watchcursor
  222.   if objectp(oGame) then -- if a game in progress
  223.     if mgetworld(oGame)=char 1 of the moviename then  -- if existing game is in this world
  224.       -- you are resuming a game in the same world
  225.       go frame "Chips"
  226.       mResumeGame(oGame)
  227.       put "mresuming a game"
  228.     else
  229.       -- a game is in progress but you are in another world.
  230.       if mGetLevel(oGame)<>4 then
  231.         go frame "GameInProgress"
  232.         -- GO TO THE GAME IN PROGRESS IN ANOTHER WORLD SCREEN AND(IF OKNEWGAME)THEN DO BELOW LINES)
  233.         --        makegamebuttons me, (char 1 of the moviename)
  234.         --        set oGame=0
  235.         --        go frame "Level"
  236.       else
  237.         makegamebuttons me, (char 1 of the moviename)
  238.         go frame "Chips"
  239.         mPrepGame(oGame, char 1 of the moviename)
  240.         mResumeGame(oGame)
  241.       end if
  242.     end if
  243.   else -- no game in progress
  244.     makegamebuttons me, (char 1 of the moviename)
  245.     go frame "Level"
  246.     put "Entered"
  247.   end if
  248. end mEnterGame
  249.  
  250. on MakeGameButtons me, pWorld
  251.   if pWorld=iButtonWorld then
  252.     set iButtonWorld=pWorld
  253.     set vButtonsExist=1
  254.   else
  255.     set vButtonsExist=0
  256.   end if
  257.   
  258.   if not(vButtonsExist) then
  259.     set vButCast=the number of cast "New Game Normal"
  260.     set gGameBtn1 = birth(script "a9StateButton", 24, vButCast, 0, "NewGame", "HandCursor", "",0)
  261.     showcontrol(gGameBtn1)
  262.     
  263.     set vButCast=the number of cast "Help Normal"
  264.     set gGameBtn2 = birth(script "a9StateButton", 25, vButCast, 0, "HelpGame", "HandCursor", "",0)
  265.     showcontrol(gGameBtn2)
  266.     --set gGameBtn4 = birth(script "a9StateButton", 42, vButCast, 0, "HelpGame", "HandCursor", "",0)
  267.     
  268.     set vButCast=the number of cast "Exit Normal"
  269.     set gGameBtn3 = birth(script "a9StateButton", 26, vButCast, 0, "ExitGame", "HandCursor", "",0)
  270.     showcontrol(gGameBtn3)
  271.     
  272.     set vButCast=the number of cast "OK Normal"
  273.     set gGameBtn5 = birth(script "a9StateButton", 39, vButCast, 0, "OKNewGame", "HandCursor", "",0)
  274.     
  275.     set vButCast=the number of cast "Cancel Normal"
  276.     set gGameBtn6 = birth(script "a9StateButton", 40, vButCast, 0, "CancelNewGame", "HandCursor", "",0)
  277.     
  278.     put "HERE's pWorld:"&pWorld
  279.     
  280.     set vSnd= 0 --the number of cast "Guess"
  281.     set vButCast=the number of cast (pWorld&".Normal A")  
  282.     set gAnsA = birth(script "a9StateButton", 39, vButCast, vSnd, "AnswerA", "HandCursor", "",1)
  283.     set vButCast=the number of cast (pWorld&".Normal B")
  284.     set gAnsB = birth(script "a9StateButton", 40, vButCast, vSnd, "AnswerB", "HandCursor", "",1)
  285.     set vButCast=the number of cast (pWorld&".Normal C")
  286.     set gAnsC = birth(script "a9StateButton", 41, vButCast, vSnd, "AnswerC", "HandCursor", "",1)
  287.   end if
  288. end MakeGameButtons
  289.  
  290. on MakeCrossButtons me
  291.   if char 1 of the moviename="V" then
  292.     set gBtn16 = birth(script "a3StateButton", 46, 1931, 0, "EGameSwitch", "HandCursor")
  293.     set gBtn17 = birth(script "a3StateButton", 47, 1925, 0, "AGameSwitch", "HandCursor")
  294.     set gBtn18=0
  295.   else
  296.     if char 1 of the moviename="E" then
  297.       set gBtn16=0
  298.       set gBtn17 = birth(script "a3StateButton", 47, 1925, 0, "AGameSwitch", "HandCursor")
  299.       set gBtn18 = birth(script "a3StateButton", 48, 1928, 0, "VGameSwitch", "HandCursor")      
  300.     else
  301.       set gBtn16 = birth(script "a3StateButton", 46, 1931, 0, "EGameSwitch", "HandCursor")
  302.       set gBtn17=0
  303.       set gBtn18 = birth(script "a3StateButton", 48, 1928, 0, "VGameSwitch", "HandCursor")        
  304.     end if
  305.   end if
  306. end MakeCrossButtons
  307.  
  308. on mStartGame me, pLevel
  309.   go frame "chips"
  310.   put ogame
  311.   put oLastGame
  312.   if objectp(oGame) then
  313.     mFlushChips(oGame)
  314.     set oGame=0
  315.   else
  316.     if objectp(oLastGame) then
  317.       mFlushChips(oLastGame)
  318.       set oLastGame=0
  319.     end if
  320.   end if
  321.   set vSound=cast "Drums"
  322.   puppetsound vSound
  323.   updatestage
  324.   set oGame=birth(script "GameClass", pLevel, char 1 of the moviename)
  325.   mUpdateScore(oGame)
  326. end mstartgame
  327.  
  328. on mGoHelp me
  329.   set iFrameBeforeHelp=the frame
  330.   if objectp(gBtn16) then
  331.     hidecontrol(gBtn16)
  332.   end if
  333.   if objectp(gBtn17) then
  334.     hidecontrol(gBtn17)
  335.   end if
  336.   if objectp(gBtn18) then
  337.     hidecontrol(gBtn18)
  338.   end if
  339.   go frame "Help1"  
  340. end mGoHelp
  341.  
  342. on mLeaveHelp me
  343.   go frame iFrameBeforeHelp
  344.   if objectp(gBtn16) then
  345.     showcontrol(gBtn16)
  346.   end if
  347.   if objectp(gBtn17) then
  348.     showcontrol(gBtn17)
  349.   end if
  350.   if objectp(gBtn18) then
  351.     showcontrol(gBtn18)
  352.   end if
  353. end mLeaveHelp
  354.